import Taro from '@tarojs/taro'
import {Image, View} from "@tarojs/components";
import PropTypes from "prop-types"

import './index.scss'

export default class Index extends Taro.Component {

  propTypes = {
    user: PropTypes.object.isRequired
  };

  static defaultProps = {
    user: {
      userDetail: {
        university:'XX大学',
        grade: '大一',
        college: '计算机学院',
        major: '网络工程',
      },
      userInfo: {
        avatarUrl: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2049932359,1005954708&fm=15&gp=0.jpg',
        nickName: '未登录'
      }
    }
  };

  constructor(props) {
    super(props);
  }

  render() {
    const {user} = this.props;

    return (
      <View className='user-profile'>
        <View className='at-row at-row__align--center' style={{height: '120px', background: '#fff'}}>
          <View className='at-col at-col-1 at-col--auto' style={{height: '120px'}}>
            <Image src={user.userInfo.avatarUrl} style={{height: '80px', width: '80px', padding: '20px'}} />
          </View>
          <View className='at-col'>
            <View style={{fontSize: '20px'}}>{user.userInfo.nickName}</View>
            <View style={{fontSize: '14px', color: '#aaa', marginTop: '6px'}}>
              {user.userLastTimeClass.className}
            </View>

          </View>
        </View>
      </View>
    )
  }
}


